package heven.holt.wan.android.viewmodel.factory

import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import heven.holt.wan.android.viewmodel.SystemArticleViewModel

@AssistedFactory
interface SystemArticleViewModelProvider {
    fun createSystemArticleViewModel(
        @Assisted("cid") cid: Int
    ): SystemArticleViewModel
}

class SystemArticleViewModelFactory(
    private val systemArticleViewModelProvider: SystemArticleViewModelProvider,
    private val cid: Int
) : ViewModelProvider.Factory {
    override fun <T : ViewModel?> create(modelClass: Class<T>): T {
        return systemArticleViewModelProvider.createSystemArticleViewModel(cid) as T
    }
}